<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <link rel="stylesheet" type="text/css" href="/static/css/top.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/newmain.css"/>
    <link href="favicon.ico" rel="shortcut icon">
    <link href="/static/css/fSelect.css" type="text/css" rel="stylesheet">
    <title>{{.sysname}}</title>
</head>
{{template "top.html" .}}
<body class="camslist_body">

{{$UID := .uid}}
{{$na := .na}}

<div class="tbarlist">
    <div class="modal-headers">接口列表</div>

    <div class="box-search">
        <form class="search_form">
            <label class="label">名称&nbsp;</label>
            <div class="area">
                <input type="text" placeholder="请输入接口名称" id="name" value="{{$na}}"/>
            </div>

            <div>
                <input type="button" id="submit_form" class="form_btn" value='查询'/>
            </div>
            <div>
                <a class="form_btn" href="/interfacedefine/add">新增</a>
            </div>
        </form>


    </div>
</div>


<div class="tableout">
    <table class="tab_algo"  >
        <thead>
        <tr class="tab_rows1">
            <th class="td_center">ID</th>
            <th>名称</th>
            <th>描述</th>
            <th>是否启用</th>
            <th>语言</th>
            <th>method</th>
            <th class="td_center">操作</th>
        </tr>
        </thead>
        <tbody>
        {{range $index,$vo := .list}}
            {{if IsOdd $index}}
                <tr class="rows_restodd">
            {{else}}
                <tr class="rows_resteven">
            {{end}}
                <td id="interface_id" class="td_center">{{$vo.Id}}</td>
                <td class="td_title">

                    <a href="/interfacedefine/edit/id/{{$vo.Id}}" class="rows_hover">{{$vo.Name}}</a>

                </td>
                <td>{{$vo.Description}}</td>
                <td>{{if eq $vo.Ison "on"}}启用{{else}}停止{{end}}</td>
                {{range $vl := $.LangTypes}}
                    {{if eq $vl.Lang $vo.Lang}}
                        <td>{{$vl.Name}}</td> {{end}}
                {{end}}
                <td>{{$vo.Method}}</td>
                <td class="td_center">

                    <a href="/interfacedefine/edit/id/{{$vo.Id}}"
                       class="tab_edit">编辑 </a>

                    <a href="/interfacedefine/delete/id/{{$vo.Id}}" class="tab_del"
                       id="change_status">删除</a>

                </td>
            </tr>
        {{end}}
        </tbody>
    </table>
</div>
<div class="box-footer">
    <div id="page_extra">
        {{.Page.TotalCount}}条 <span id="page_num">共{{.Page.TotalPage}}</span>页
        <input type="text" id="page_skip" placeholder='跳转页' autocomplete="off"/>
        <button id="page_sBtn">Go</button>
    </div>
    <ul class="page-nav" id="page"></ul>
</div>
</body>
<script src="/static/js/jquery-3.4.1.min.js" type="text/javascript"></script>
<script src="/static/js/bootstrap-paginator.min.js" type="text/javascript"></script>
<script src="/static/js/main.js"></script>
<script>

    var skillJs = {
        bootsPage: function () {
            var total = "{{.Page.TotalPage}}";
            var curPage = '{{.Page.PageNo}}';
            var tipArr = ['请输入正确的页码', '页数输入错误', '已经是当前页'];

            //搜索之后的分页分别处理
            function hrefn(page) {
                window.location.href = "/interfacedefine/list/?p=" + page + "&langs=" + $('.search_select').val() + "&name=" + "{{.Name}}";
            }

            //调用main.js的page方法
            Ai_ServerJs.page(total, curPage, tipArr, hrefn);
        },
        delOneList: function () {
            Ai_ServerJs.del('确定要删除此记录吗？');
        },
        submit: function () {
            $('#submit_form').click(function () {
                $("#form1").submit();
            });

            $('#form1').submit(function () {
                $('#title').val($.trim($('#title').val()));
                $('#cc').val($.trim($('#cc').val()));
            });
        },
        reset: function () {
            $('#reset').click(function () {
                $("#tag").val("");
                $("#title").val("");
                $("#form1").submit();
            });
        },
        notFind: function () {
            Ai_ServerJs.notFind('抱歉，未查询到信息');
        }

    }


    for (var i in skillJs) {
        if (typeof skillJs[i] == 'function') {
            skillJs[i]();
        }
    }

</script>
</html>